package web.fabrimind.dm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.dm.mapper.EquipmentAlarmMapper;
import web.fabrimind.dm.domain.EquipmentAlarm;
import web.fabrimind.dm.service.IEquipmentAlarmService;

/**
 * 设备报警记录Service业务层处理
 * 
 * @author zhihui
 * @date 2025-03-25
 */
@Service
public class EquipmentAlarmServiceImpl implements IEquipmentAlarmService 
{
    @Autowired
    private EquipmentAlarmMapper equipmentAlarmMapper;

    /**
     * 查询设备报警记录
     * 
     * @param alarmId 设备报警记录主键
     * @return 设备报警记录
     */
    @Override
    public EquipmentAlarm selectEquipmentAlarmByAlarmId(Long alarmId)
    {
        return equipmentAlarmMapper.selectEquipmentAlarmByAlarmId(alarmId);
    }

    /**
     * 查询设备报警记录列表
     * 
     * @param equipmentAlarm 设备报警记录
     * @return 设备报警记录
     */
    @Override
    public List<EquipmentAlarm> selectEquipmentAlarmList(EquipmentAlarm equipmentAlarm)
    {
        return equipmentAlarmMapper.selectEquipmentAlarmList(equipmentAlarm);
    }

    /**
     * 新增设备报警记录
     * 
     * @param equipmentAlarm 设备报警记录
     * @return 结果
     */
    @Override
    public int insertEquipmentAlarm(EquipmentAlarm equipmentAlarm)
    {
        equipmentAlarm.setCreateTime(DateUtils.getNowDate());
        return equipmentAlarmMapper.insertEquipmentAlarm(equipmentAlarm);
    }

    /**
     * 修改设备报警记录
     * 
     * @param equipmentAlarm 设备报警记录
     * @return 结果
     */
    @Override
    public int updateEquipmentAlarm(EquipmentAlarm equipmentAlarm)
    {
        equipmentAlarm.setUpdateTime(DateUtils.getNowDate());
        return equipmentAlarmMapper.updateEquipmentAlarm(equipmentAlarm);
    }

    /**
     * 批量删除设备报警记录
     * 
     * @param alarmIds 需要删除的设备报警记录主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentAlarmByAlarmIds(Long[] alarmIds)
    {
        return equipmentAlarmMapper.deleteEquipmentAlarmByAlarmIds(alarmIds);
    }

    /**
     * 删除设备报警记录信息
     * 
     * @param alarmId 设备报警记录主键
     * @return 结果
     */
    @Override
    public int deleteEquipmentAlarmByAlarmId(Long alarmId)
    {
        return equipmentAlarmMapper.deleteEquipmentAlarmByAlarmId(alarmId);
    }
}
